<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        let name2 = "laowang";

        let na = 'name';

        let a = 'age';

        // 建议 以字母开头
        let sex = 'a666';

        let fn = function(){
            console.log(123);
        }

        // 属性名 可以声明成变量
        let obj = {
            [na]:name2,
            [a]:18,
            [sex]:'男',
            [fn]:'lalala'
        }

        console.log(obj);

        // console.log(obj[666]);

        // console.log(obj.a666);

        // console.log(obj[fn]); //lalala

    </script>
</body>
</html>